<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <base href="<%=basePath%>">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>Title</title>
    <script src="js/jquery-1.8.0.js"></script>
    <script src="js/jquery-ui.js"></script>
    <link rel="stylesheet" type="text/css" href="css/maintable.css" ></link>
    <script>
        $(function(){
            $("#ch_checkall,#top_ch_checkall").click(function(){
                if(this.checked){
                    $("input[name=ck_id]").attr("checked","checked");
                }else{
                    $("input[name=ck_id]").removeAttr("checked");
                }
            });

            $("table tr").mouseover(function(){
                $(this).css("background","#D3EAEF");
                $(this).siblings().css("background","white");
            });
        });

        $(function () {
            $("#but1").click(function () {
                var a= $("#sreaName").val();
                var b= $("#startDate").val();
                var c= $("#endDate").val();
                window.location.href="MemberServlet?flag=manage&pageIndex=1&sreaName="+a+"&startDate="+b+"&endDate="+c;
            });
            $("#but2").click(function () {
                var a= $("#sreaName").val();
                var b= $("#startDate").val();
                var c= $("#endDate").val();
                window.location.href="MemberServlet?flag=manage&sreaName="+a+"&startDate="+b+"&endDate="+c+"&pageIndex="+${page.pageIndex-1};
            });
            $("#but3").click(function () {
                var a= $("#sreaName").val();
                var b= $("#startDate").val();
                var c= $("#endDate").val();
                window.location.href="MemberServlet?flag=manage&sreaName="+a+"&startDate="+b+"&endDate="+c+"&pageIndex="+${page.pageIndex+1};
            });
            $("#but4").click(function () {
                var a= $("#sreaName").val();
                var b= $("#startDate").val();
                var c= $("#endDate").val();
                window.location.href="MemberServlet?flag=manage&sreaName="+a+"&startDate="+b+"&endDate="+c+"&pageIndex="+${page.pageCount };
            });
        });
        $(function () {
            $("#duoxuan").click(function () {
                var xuanze=document.getElementsByName("ck_id");
                var st=document.getElementsByName("st");
                var idlist="";
                for(var i=0;i<xuanze.length;i++){
                    if(xuanze[i].checked==true){
                        idlist=idlist+xuanze[i].id+" ";
                    }
                }
                window.location.href="MemberServlet?flag=duoshan&id="+idlist+"&pageIndex="+${page.pageIndex};
            });
        });
        $(function () {
            $("#subx").click(function () {
                var a= $("#sreaName").val();
                var b= $("#startDate").val();
                var c= $("#endDate").val();
                window.location.href="MemberServlet?flag=manage&sreaName="+a+"&startDate="+b+"&endDate="+c;
            }) ;
        });

    </script>

</head>
<body>
<div class ="div_title">
    <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>商品基本信息列表</span></div>
    <div class="div_titleoper">
        <input type="checkbox" id="top_ch_checkall"/> 全选
        <a href="goods/goods-add.jsp"><img src="images/add.gif"/>添加 </a>
        <a onclick="return confirm('确定要删除吗')" id="duoxuan"><img src="images/del.gif"/>删除</a> </div>
</div>

<form action="xxx"  name="form1">
    会员账号：<input name="sreaName" id="sreaName" value="${sreaName}" >
    注册日期 从：<input type="date" id="startDate" name="startDate" value="${startDate}" >
    到<input type="date" name="endDate" id="endDate" value="${endDate}" >
    <input type="button" id="subx" value="查询">
    <table class="main_table" >
        <tr>
            <th><input type="checkbox" id="ch_checkall" /></th>	<th>账号</th> 	<th>姓名</th>	<th>电话</th>  <th>邮箱</th> 	<th>注册日期</th><th>会员等级</th>	<th>操作</th>
        </tr>
        <c:forEach var="c" items="${mlist}">
            <tr>
                <td>
                    <input type="checkbox" name="ck_id" id="${c.id}" />
                </td>
                <td>${c.memberNo}</td>
                <td >${c.memberName}</td>
                <td> <a >${c.phone}</a> </td>
                <td> <a >${c.email}</a> </td>
                <td> <a ><fmt:formatDate value="${c.registerDate}" pattern="yyyy-MM-dd HH:mm:ss"/></a> </td>
                <td> <a >${c.memberLevel}</a> </td>
                <td>
                    <a href="MemberServlet?flag=srea&id=${c.id}&pageIndex=${page.pageIndex}">查看</a> |
                    <a href="MemberServlet?flag=del&id=${c.id}&pageIndex=${page.pageIndex}" onclick="return confirm('确定要删除吗')">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
</form>

<div class="div_page" >
    <div class="div_page_left">
        共有 <label>${page.rowCount }</label> 条记录，
        当前第 <label>${page.pageIndex}</label> 页，
        共 <label>${page.pageCount }</label> 页
    </div>
    <div class="div_page_right" >
        <c:choose>
            <c:when test="${page.hasPre }">
                <button id="but1">首页</button>
                <button id="but2"> 上一页</button>
            </c:when>
            <c:otherwise>
                首页
                上一页
            </c:otherwise>
        </c:choose>

        <c:choose>
            <c:when test="${page.hasNext }">
                <button id="but3">下一页 </button>
                <button id="but4">尾页</button>
            </c:when>
            <c:otherwise>
                下一页
                尾页
            </c:otherwise>
        </c:choose>
        <button id="but5">转到</button>
        <input type="text" name="pageIndex" id="pageIndex" value="1" /> 页

    </div>

</div>
</body>
</html>
